﻿
namespace CsvSegítő.typeconverter
{
    using System;

    public class GuidConverter : NonNullableConverter<Guid>
    {
        private readonly string format;

        public GuidConverter()
        {
            this.format = string.Empty;
        }

        public GuidConverter(string format)
        {
            this.format = format;
        }

        protected override bool InternalConvert(string value, out Guid result)
        {
            return string.IsNullOrWhiteSpace(format) ? Guid.TryParse(value, out result) : Guid.TryParseExact(value, format, out result);
        }
    }
}
